<?php
namespace App\Services\Fund;
use App\Services\Fund\FundOptionLog\FundOptionLogLogic;
/**
 * 资金借款日志
 * Class FundBorrowLog
 * @package App\Services\Fund
 */
class FundOptionLog
{
    // 获取所资金操作日志(分页)
    public function list($data): array
    {
        $data = init_array($data,['page'=>'1', 'list_rows'=>'', 'type'=>'', 'keywords'=>'', 'startTime'=>'', 'endTime'=>'']);
        if (!empty($startTime) && !empty($endTime) && $startTime>$endTime ) {
            return null_data($data,"开始时间必须小于结束时间！");
        }
        return (new FundOptionLogLogic())->list($data);
    }
    // 获取某些user_ids的的资金操作日志(分页)
    public function listByUserIds($data): array
    {
        $data = init_array($data,['page'=>'1', 'list_rows'=>'', 'user_ids'=>' ', 'type' => '']);
        ValidateFundOptionLog::checkValidate($data, ['user_ids']);
        return (new FundOptionLogLogic())->listByUserIds($data);
    }
    // 获取某个用户某个状态的资金操作日志分页数据
    public function listByUserType($data): array
    {
        $data = init_array($data,['user_id'=>'0', 'type'=>'', 'page'=>'1', 'list_rows'=>15, 'money'=>'', 'time'=>'']);
        ValidateFundOptionLog::checkValidate($data, ['user_id','type','money','time']);
        return (new FundOptionLogLogic())->listByUserType($data);
    }
    /*获取管理员冻结资金、积分、亚数币的原因记录*/
    public function freezeOperateReason($data): array
    {
        $data = init_array($data,['page'=>1, 'list_rows'=>15, 'keywords'=>'', 'type'=>'']);
        if (empty($data)) {
            return null_data($data,"参数不能为空！");
        }
        $validateInitData = ['type' => true];
        ValidateFundOptionLog::checkValidate($data, ['page','list_rows','type','type'], true, $validateInitData);
        return (new FundOptionLogLogic())->freezeOperateReason($data);
    }
    /*获取某条原因记录相关的解冻详情*/
    public function reasonUnfreezeInfo($data): array
    {
        $data = init_array($data,['obj_id'=>0, 'user_id'=>0, 'app_id'=>0, 'action'=>' ']);
        ValidateFundOptionLog::checkValidate($data, ['obj_id','user_id','app_id','action']);
        return (new FundOptionLogLogic())->reasonUnfreezeInfo($data);
    }

}
